from rest_framework import serializers

from areas.models import Areas


class AreasListSerializer(serializers.ModelSerializer):
    class Meta:
        model = Areas
        fields = ("id", "name")


class SubAreaSerializer(serializers.ModelSerializer):
    """
    子集行政区
    """
    subs = AreasListSerializer(many=True)

    class Meta:
        model = Areas
        fields = ("id", "name", "subs")
